<!--
  User: Kuttubek Aidaraliev
  Date: 06.05.2010
  Time: 14:13:37
-->
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="../../WEB-INF/jspx/common/template.xhtml">
  <ui:define name="head">
      <title>
          <h:outputText value="#{messages.creatingContactPerson}" rendered="#{contactPersonBeanController.newEntity}"/>
          <h:outputText value="#{messages.editingContactPerson}" rendered="#{!contactPersonBeanController.newEntity}"/>
      </title>
  </ui:define>
  <ui:define name="body">
        <h:panelGroup rendered="#{contactPersonBeanController.newEntity}">
            <h3 align="center"><h:outputText value="#{messages.creatingContactPerson}" /></h3>
        </h:panelGroup>
        <h:panelGroup rendered="#{!contactPersonBeanController.newEntity}">
            <h3 align="center"><h:outputText value="#{messages.editingContactPerson}" /></h3>
        </h:panelGroup> 

        <ui:decorate template="../../WEB-INF/jspx/contactPerson/form.xhtml">
            <ui:define name="customerField">
                <ui:decorate template="../../WEB-INF/jspx/common/edit.xhtml">
                    <ui:define name="label"><h:outputText value="#{messages.organization}"/></ui:define>
                        <h:selectOneMenu id="organization" required="true" requiredMessage="#{messages.requiedMessage}"
                             value="#{contactPersonBeanController.entity.customer}">
                            <f:selectItems value="#{customerBeanController.selectList}"/>
                            <f:converter converterId="customerConverter"/>
                    </h:selectOneMenu>
                    <ui:param name="required" value="true"/>
                    <ui:param name="idInput" value="organization"/>
                </ui:decorate>
            </ui:define>
            <ui:define name="buttons">
                <h:commandButton value="#{messages.create}" id="create" action="#{contactPersonBeanController.inserted}"
                     rendered="#{contactPersonBeanController.newEntity}"/>
                <h:commandButton value="#{messages.update}" id="update" action="#{contactPersonBeanController.updated}"
                     rendered="#{!contactPersonBeanController.newEntity}"/>
            </ui:define>
        </ui:decorate>

  </ui:define>
</ui:composition>